﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 第二次作业
{
    public partial class 注册 : Form
    {
        Bank bank = new Bank();

        public 注册(Bank selectbank)
        {
            InitializeComponent();
            bank = selectbank;
        }
        

        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton2.Checked)
            {
                TrustAccount trustAccount = new TrustAccount();
                trustAccount.setId(int.Parse(textBox1.Text));
                trustAccount.setCode(textBox2.Text);
                trustAccount.trustcredit = double.Parse(textBox3.Text);
                bank.TrustAccounts.Add(trustAccount);
            }
            if (radioButton1.Checked)
            {
                Account Account = new Account();
                Account.setId(int.Parse(textBox1.Text));
                Account.setCode(textBox2.Text);
                Account.setMoney(double.Parse(textBox3.Text));
                bank.Accounts.Add(Account);
            }
            MessageBox.Show("注册成功");
        }
    }
}
